package ca.eloas.judging.rest.resources;

import ca.eloas.judging.model.Team;
import ca.eloas.judging.model.TeamObject;
import ca.eloas.restsupport.ObjectFactory;
import ca.eloas.restsupport.requests.GetRequest;
import ca.eloas.restsupport.requests.RequestFactory;

import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import static com.googlecode.objectify.ObjectifyService.ofy;

/**
 * @author JP
 */
@Path("/try")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class CheckResource {


    @Inject
    RequestFactory factory;

    @Inject
    ObjectFactory objectFactory;

    @GET
    @Path("/")
    public Team get() {

        String useless = "Foo";
        GetRequest<String, Team> request =  factory.createGetRequest(useless, Team.class);
        Team t = request.createMessageWith(objectFactory).runAll().now();
        t.setName("Foo");
        return t;
    }

    @PUT
    @Path("/")
    public Response get(Team t) {

        return Response.ok().build();
    }

}
